<?php get_header(); ?>
	
		<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
apppppppppppppppppppppppppppppppppp
<h1 class="page-title"><?php
printf( __( 'Events in Location: %s', 'twentyten' ), '<span>' . $term->name . '</span>' );
?></h1>
	
		<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<nav>
			<span class="left"><?php next_post_link('&laquo; %link') ?></span>
			<span class="right"><?php previous_post_link('%link &raquo;') ?></span>
		</nav>
		<div class="clear"></div>
		
		<article>
			<h1 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>				
            	<small>
					<time datetime="<?php the_time('Y-N-j\TG:H:m')?>"><?php the_time('Y-n-j g:h A') ?></time> in  <?php the_category(', ') ?> | <?php comments_popup_link('没有评论', '仅一条评论', '% 条评论', 'commentslink', __('评论关闭')); ?>
				</small>

			<div class="content">
			<?php the_content(); ?>
			</div>
			<p>关键词: <?php the_tags('',',', ''); ?> <?php edit_post_link('Edit', '', ''); ?></p>
                            <nav class="related"><h3>你可能也感兴趣:</h3>
<ul>
<?php
$post_num = 5; // Num Set.
global $post;
$tmp_post = $post;
$tags = ''; $i = 0; // Get Articles by tags .
$exclude_id = $post->ID;
$posttags = get_the_tags();
if ( $posttags ) {
  foreach ( $posttags as $tag ) $tags .= $tag->name . ',';
  $tags = strtr(rtrim($tags, ','), ' ', '-');
  $myposts = get_posts('numberposts='.$post_num.'&tag='.$tags.'&exclude='.$exclude_id);
  foreach($myposts as $post) {
    setup_postdata($post);
    ?>
    <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php
    $exclude_id .= ','.$post->ID; $i ++;
  }
}
if ( $i < $post_num ) { // No enough tags, With Category.
  $post = $tmp_post; setup_postdata($post);
  $cats = ''; $post_num -= $i;
  foreach ( get_the_category() as $cat ) $cats .= $cat->cat_ID . ',';
  $cats = strtr(rtrim($cats, ','), ' ', '-');
  $myposts = get_posts('numberposts='.$post_num.'&category='.$cats.'&exclude='.$exclude_id);
  foreach($myposts as $post) {
    setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php
    $i ++;
  }
}
if ( $i == 0 ) echo '<li>没有文章</li>';
$post = $tmp_post; setup_postdata($post);
?>
</ul></nav>

		</article>
        
	<?php comments_template(); ?>
	<?php endwhile; else : ?>
		<h2>Nothing here</h2>
		<h3>Search</h3>
   			<?php get_template_part( 'searchform', 'index' );?>	
		<?php endif; ?>
<?php get_sidebar(); ?>
	</section><!-- end wrap -->
<?php get_footer(); ?>